import AttackDamageUP from "../BuffEffects/AttackDamageUP";
import AttackSlowDown from "../BuffEffects/AttackSlowDown";
import AttackSlowUp from "../BuffEffects/AttackSlowUp";
import FrozenBuff from "../BuffEffects/FrozenBuff";
import MoveSlowDown from "../BuffEffects/MoveSlowDown";

export default class BuffTypeManager {

    private static _Instance: BuffTypeManager;
    private constructor() { }
    //公开的方法
    public static get Instance(): BuffTypeManager {
        if (!this._Instance) {
            this._Instance = new BuffTypeManager();
            this._Instance.InitType();
        }
        return this._Instance;
    }
    private InitType() {
        //Buff
        this.BuffTypeMap.set("FrozenBuff", FrozenBuff);
        this.BuffTypeMap.set("MoveSlowDown", MoveSlowDown);
        this.BuffTypeMap.set("AttackSlowDown", AttackSlowDown);
        this.BuffTypeMap.set("AttackSlowUp", AttackSlowUp);
        this.BuffTypeMap.set("AttackDamageUP", AttackDamageUP);
    }
    /**
        * @param DoesTheEffectsTypeExist 检测是否拥有当前名称的Buff类型
        * @param TypeName 
        */
    DoesTheBuffTypeExist(TypeName: string): boolean {

        if (this.BuffTypeMap.has(TypeName)) {
            return true;
        }
        return false;
    }

    /**
  * @param GetTypeByName 根据名称获取类型
  * @param TypeName      //与类型相同的字符串
  */
    GetTypeByName(TypeName: string): any {

        if (this.BuffTypeMap.has(TypeName)) {

            return this.BuffTypeMap.get(TypeName);

        }
        return null;
    }

    /**
 * @param BuffTypeMap Buff类型Map
 */
    BuffTypeMap: Map<string, any> = new Map<string, any>();

}